<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>日程管理-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<style>
	.folder span{ display: inline-block; margin: 0 40px 0 1px; }
</style>
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">个人 > 日程管理</div>
	</div>
	<div id="content">
		<div class="classify">
			<ul>
				<li><a href="__APP__/Index/schedule_list">日程管理日历</a></li>
				<li><a href="javascript:;" class="current">日程管理列表</a></li>
			</ul>
		</div>
		<div>
			<table class="table table-bordered table-hover">
				<tr class="table-header fixed-table-header">
					<td width="">
						<select name="type" class="w90">
							<option value="-10" <if condition="$type eq -10">selected</if>>全部</option>
							<option value="1" <if condition="$type eq 1">selected</if>>在岗</option>
							<option value="2" <if condition="$type eq 2">selected</if>>出差</option>
							<option value="3" <if condition="$type eq 3">selected</if>>休息</option>
							<option value="4" <if condition="$type eq 4">selected</if>>请假</option>
						</select>
					</td>
					<td width="">填报日期</td>
					<td width="">项目编号</td>
					<td width="">项目名称</td>
					<td width="">填报岗位</td>
					<if condition="$type eq 1 or $type eq 2">
						<td width="">事项编号</td>
						<td width="">工作类型</td>
						<td width="">工作内容</td>
					</if>
					<if condition="$type eq 3">
						<td width="">代理人姓名-职位(手机号)</td>
						<td width="">状态</td>
					</if>
					<if condition="$type eq 4">
						<td width="">ekp单号</td>
					</if>
					<td width="">管理</td>
				</tr>
				<if condition="$result eq NULL">
				<tr><td class="Text_c" <if condition="$type eq 1 or $type eq 2">colspan="8"<elseif condition="$type eq 3"/>colspan="7"<else/>colspan="6"</if>>暂无相关数据</td></tr>
				</if>
				<foreach name="result" item="vo">
					<tr>
						<td>
							<font color="{$vo['color']}">{$vo['type_name']}</font>
						</td>
						<td>
							<foreach name="vo['detail']" item="wo">
								{$wo['date']}<br/>
							</foreach>
						</td>
						<td>{$vo['project_num']}</td>
						<td>{$vo['project_name']}</td>
						<td>{$vo['fill_post_name']}</td>
						<if condition="$type eq 1 or $type eq 2">
							<td width="">{$vo['matter_id']}</td>
							<td width="">{$vo['work_type_name']}</td>
							<td width="">{$vo['work_content']}</td>
						</if>
						<if condition="$type eq 3">
							<td>{$vo['agent']}-{$vo['agent_post']}({$vo['agent_tel']})</td>
							<td style="padding:0" class="ding">
								<div class="project_user_alert">
									<if condition="$vo['status'] eq -1">未提交<if condition="$vo['dh_user'] neq NULL"><span title="{$vo['dh_user']}:{$vo['dh_message']}" data-placement="left" data-toggle="tooltip" class="red">(已打回)<span></if>
									<elseif condition="$vo['status'] eq 3"/>已完结<i class="glyphicon glyphicon-exclamation-sign ml10" style="color:#999"></i>
									<else />
										<if condition="$vo['status'] eq 1">待【{$vo['manager_user']}】审核<i class="glyphicon glyphicon-exclamation-sign ml10" style="color:#999"></i>
										<elseif condition="$vo['status'] eq 2"/>待【{$vo['audit_useraa']}】审核<i class="glyphicon glyphicon-exclamation-sign ml10" style="color:#999"></i>
										</if>
									</if>
									<if condition="$vo['status'] gt -1">
									<div class="project_user_box">
										<if condition="$vo['status'] neq -1">
											<div class="project_user_title">审核流程</div>
											<foreach name="vo['audit_arr']" item="vv">
												<div class="p"><span class="bold">{$vv['audit_name']}</span>
												<if condition="$vv['audit_date'] neq NULL">
													<span>{$vv['audit_user']}({$vv['audit_date']|substr=0,10})<if condition="$vv['audit_comments'] neq NULL">:{$vv['audit_comments']}</if></span>
													<if condition="$vv['dh_message'] neq NULL"><br/><span>打回至"{$vv['arrive_name']}"({$vv['dh_date']|substr=0,10})原因:{$vv['dh_message']}</span></if><if condition="$vv['arrive_info'] neq NULL"><br/><span>"{$vv['arrive_name']}"({$vv['arrive_date']|substr=0,10})回复:{$vv['arrive_info']}</span></if>
												<else/>
													<span class='red'>[未审核]{$vv['audit_user']}</span>
													<if condition="$vv['dh_message'] neq NULL"><br/><span class='red'>打回至"{$vv['arrive_name']}"({$vv['dh_date']|substr=0,10})原因:{$vv['dh_message']}</span></if><if condition="$vv['arrive_info'] neq NULL"><br/><span class='red'>"{$vv['arrive_name']}"({$vv['arrive_date']|substr=0,10})回复:{$vv['arrive_info']}</span></if>
												</if>
												</div>
											</foreach>
										</if>
										<!--<if condition="$vo['dh_message'] neq NULL">
											<div class="p"><span class="red bold">打回原因 </span><span class="red">{$vo['dh_user']}({$vo['dh_date']|substr=0,10}):{$vo['dh_message']}</span></div>
										</if>
										<if condition="$vo['submit_info'] neq NULL">
											<div class="p"><span class="red bold">重新提交 </span><span class="red">{$vo['submit_user']}:{$vo['submit_info']}</span></div>
										</if>-->
									</div>
									</if>
								</div>
							</td>
						</if>
						<if condition="$type eq 4">
							<td width="">{$vo['ekp']}</td>
						</if>
						<td width="80">
							<if condition="$vo['noedit'] neq 1">
								<if condition="$vo['type'] eq 3">
									<if condition="$vo['status'] eq -1">
										<if condition="$vo['dh_message'] neq '' and $vo['arrive_status'] eq -1">
											<a href="javascript:;" mid="{$vo['audit_id']}" uuid="{$login_id}" data-toggle="tooltip" data-placement="left" title="重新提交审核" class="audit2 mr5"><i class="glyphicon glyphicon-ok"></i></a>
										<else/>
											<a href="javascript:;" mid="{$vo['audit_id']}" uuid="{$login_id}" data-toggle="tooltip" data-placement="left" title="提交审核" class="audit mr5"><i class="glyphicon glyphicon-ok"></i></a>
										</if>
										<a href="javascript:;" mid="{$vo['id']}" data-toggle="tooltip" data-placement="left" title="" class="edit mr5" data-original-title="编辑"><i class="glyphicon glyphicon-edit"></i></a>
										<a href="javascript:;" mid="{$vo['id']}" action="delete" data-toggle="tooltip" data-placement="left" title="删除" class="delete"><i class="glyphicon glyphicon-trash"></i></a>
									<elseif condition="$vo['status'] eq 1"/>
										<a href="javascript:;" mid="{$vo['audit_id']}" data-toggle="tooltip" data-placement="left" title="放弃提交" class="remove"><i class="glyphicon glyphicon-remove"></i></a>
									</if>
								<else/>
									<a href="javascript:;" mid="{$vo['id']}" data-toggle="tooltip" data-placement="left" title="" class="edit mr5" data-original-title="编辑"><i class="glyphicon glyphicon-edit"></i></a>
									<a href="javascript:;" mid="{$vo['id']}" action="delete" data-toggle="tooltip" data-placement="left" title="删除" class="delete"><i class="glyphicon glyphicon-trash"></i></a>
								</if>
							</if>
						</td>
					</tr>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!-- 弹框 -->
<div class="modal fade" id="edit_modal">
	<div class="modal-dialog w800">
		<div class="modal-content">
			<div class="modal-header">
				<h4>编辑日程</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				<div class="form-main" style="border:none;margin-bottom:0">
					<div class="form-item clearfix">
						<div class="input-label">日期</div>
						<div class="input-item">
							<span class="txt mr10 ajax_date"></span>
						</div>
					</div>
					<div class="form-item clearfix">
						<div class="input-label">填报类型</div>
						<div class="input-item">
							<span class="txt mr10 ajax_lx"></span>
						</div>
					</div>
					<div class="form-item clearfix">
						<div class="input-label">项目</div>
						<div class="input-item">
							<select name="pid_edit" class="form-control select-add w300" autocomplete="off">
								<option value="-10" t-name="">请选择</option>
							</select>
							<span class="txt mr10"></span>
							<span class="error-item">必填项</span>
						</div>
					</div>
					<div class="form-item clearfix">
						<div class="input-label">填报岗位</div>
						<div class="input-item">
							<select name="fill_edit" class="form-control select-add w150" autocomplete="off">
								<option value="-10" t-name="">请选择</option>
							</select>
							<span class="txt mr10"></span>
							<span class="error-item">必填项</span>
						</div>
					</div>
					<div class="load_box"></div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--重新提交框-->
<div class="modal fade" id="myModal_submit">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>重新提交</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				<table class="table table-bordered">
					<tr>
						<td class="text-right"><strong><span class="asterisk">*</span>原因</strong></td>
						<td>
							<textarea name="remark" placeholder="重新提交理由" class="form-control w300 submit_info left" autocomplete="off"></textarea>
							<span class="error-item left">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//提交、取消提交
	$('.audit').click(function(){
		var status = 1,
			uuid = $(this).attr("uuid"),
			state = 1,
			mid = $(this).attr("mid");
		$.ajax({
			cache:true,
			type:"POST",
			dataType:"json",
			data:{"mid":mid,"status":status,"uuid":uuid,"state":state},
			url:"__APP__/Index/schedule_list_audit_ajax",
			success:function(data){
				success_pop(data.status,data.msg);
			}
		});
	})
	$('.remove').click(function(){
		var status = -1,
			state = 1,
			mid = $(this).attr("mid");
		$.ajax({
			cache:true,
			type:"POST",
			dataType:"json",
			data:{"mid":mid,"status":status,"state":state},
			url:"__APP__/Index/schedule_list_audit_ajax",
			success:function(data){
				success_pop(data.status,data.msg);
			}
		});
	})
	//删除
	$(".delete").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"__APP__/Index/schedule_list_action","data":{"id":"mid","action":"action"}});
	//筛选
	$(document).on("change","[name='type']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Index/schedule_other/type/"+val;
	});
	//编辑弹框
	$('.edit').click(function(){
		$('#edit_modal').modal("show");
		var id = $(this).attr("mid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":id,"action":"type"},
			url:"__APP__/Index/schedule_list_edit",
			success:function(data){
				$('.ajax_date').html(data['detail']['show_date']);
				$('.ajax_lx').html(data['detail']['type_name']);
				if(data['detail']['noedit']==1){
					$("[name='pid_edit']").next('.select2').remove();
					$("[name='fill_edit']").next('.select2').remove();
					$("[name='pid_edit']").hide().nextAll('.txt').show().html(data['detail']['pid']);
					$("[name='fill_edit']").hide().nextAll('.txt').show().html(data['detail']['fill_post']);
				}else{
					var phtml="<option value='-10'>请选择</option>";
					for(var i=0;i<data['plist'].length;i++){
						phtml+="<option value='"+data['plist'][i].id+"'";
						if(data['plist'][i].id==data['detail'].pid){
							phtml+=" selected";
						}
						phtml+=">["+data['plist'][i].project_num+"]"+data['plist'][i].project_name+"</option>";
					}
					$("[name='pid_edit']").html(phtml).select2();
					var thtml="<option value='-10'>请选择</option>";
					for(var t=0;t<data['fill_post'].length;t++){
						thtml+="<option value='"+data['fill_post'][t].name1+"'";
						if(data['fill_post'][t].name1==data['detail'].fill_post){
							thtml+=" selected";
						}
						thtml+=">"+data['fill_post'][t].name2+"</option>";
					}
					$("[name='fill_edit']").html(thtml).select2();
					$("[name='pid_edit']").nextAll('.txt').html('').hide();
					$("[name='fill_edit']").nextAll('.txt').html('').hide();
				}
				if((data['detail']['type']==1)||(data['detail']['type']==2)){
					$('#edit_modal .load_box').load("__APP__/Index/schedule_list_add/way/1/id/"+data['detail']['id']);
				}else if(data['detail']['type']==3){
					$('#edit_modal .load_box').load("__APP__/Index/schedule_list_add/way/3/id/"+data['detail']['id']);
				}else if(data['detail']['type']==4){
					$('#edit_modal .load_box').load("__APP__/Index/schedule_list_add/way/4/id/"+data['detail']['id']);
				}

			}
		});
	})
	
	/*重新提交*/
	$(".audit2").click(function(){
		var mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid");

		$("#myModal_submit .btn-affirm").attr("mid",mid);
		$("#myModal_submit .btn-affirm").attr("uuid",uuid);
		$(".submit_info").removeClass("red").val("");
		$('#myModal_submit').modal('toggle');
	});
	
	$("#myModal_submit .btn-affirm").click(function(){
		var mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid"),
			status = 1,
			state = 1,
			submit_info = $(".submit_info").val();

		if(submit_info==""||submit_info=="重新提交理由必填"){
			$(".submit_info").addClass("red").val("重新提交理由必填");
		}else{
			$('#myModal_submit').hide();
			$.ajax({
				cache:true,
				type:"POST",
				dataType:"json",
				global: false,
				url:"__APP__/Index/schedule_list_audit_ajax",
				data:{"mid":mid,"status":status,"uuid":uuid,"state":state,"submit_info":submit_info},
				success:function(data){
					success_pop(data['status'],data['msg']);
				}
			});
		}
	});

	$(".submit_info").focus(function(){
		if($(this).val()=="重新提交理由必填"){
			$(this).removeClass("red").val("");
		}
	});
});
</script>
</body>
</html>